home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 752 < prev    next >
Internet Message Format  |  1996-08-06  |  2KB

  1. Path: Rezonet.net!news
  2. From: ray@ultimate-tech.com (Ray Dunn)
  3. Newsgroups: comp.lang.c,comp.std.c,finet.atk.kielet.c
  4. Subject: Re: TYPEDEF and Watcom C++ 10.5
  5. Date: 16 Apr 1996 19:20:40 GMT
  6. Organization: Ultimate Technographics Inc.
  7. Distribution: world
  8. Message-ID: <4l0ru8$jol@ns.RezoNet.NET>
  9. References: <4jlu1r$cs7@nic.dataphone.se> <4kmaeb$10qi@pulp.ucs.ualberta.ca>
  10. NNTP-Posting-Host: 204.19.230.7
  11. Mime-Version: 1.0
  12. Content-Type: Text/Plain; charset=US-ASCII
  13. X-Newsreader: WinVN 0.99.7
  14.  
  15. In referenced article, Darin McBride says...
  16. >
  17. >Jarmo Paavilainen (skorpio@dataphone.se) wrote:
  18. >
  19. >> typedef struct
  20. >> {
  21. >> WORD  CheckSum;
  22. >> WORD  Version;
  23. >> BYTE  PatchLevel;
  24. >> BYTE  Name[21];
  25. >> WORD  MarkerVersion;
  26. >> }VERSION_TAG_STRUCT;
  27. >
  28. >> Shouldn't sizeof(VERSION_TAG_STRUCT) always result in 28. By other 
  29. >> words shouldn't WORD always be 16 bits and BYTE 8 bits.
  30. >
  31. >Usually, yes.
  32. >
  33. >> If so why does my compiler claim that sizeof(VERSION_TAG_STRUCT) == 
  34. >> 34.
  35. >> All this in 32 bit OS/2 PM and Watcom C++ 10.5
  36.  
  37. Here is the key *32-bit*.
  38.  
  39. Words are therefore (presumably) 32-bits, i.e. 4 bytes.  But of course 
  40. that all depends on how WORD is defined.  Neither WORD not BYTE are 
  41. standard 'C' types, but of course it is reasonable to guess.
  42.  
  43. >>You probably have double-word alignment (i.e., pack(4)):
  44.  
  45. No, no special packing involved, 3 * 4 bytes for the WORD's plus 22 
  46. bytes for the BYTE's == 34.
  47.  
  48. [posted and emailed]
  49. --
  50. Ray Dunn (opinions are my own) | Phone: (514) 938 9050
  51. Montreal                       | Phax : (514) 938 5225
  52. ray@ultimate-tech.com          | Home : (514) 630 3749
  53.  
  54.